package com.example.java_chatroom.demo;

import java.util.Comparator;
import java.util.PriorityQueue;

public class Demo04 {
    public static void main(String[] args) {
        int[] arr = {4,1,9,2,8,0,7,3,6,5};
        PriorityQueue<Integer> queue = new PriorityQueue<>(arr.length);
        for (int x:arr) {
            queue.offer(x);
        }
        System.out.println("queue.size():" + queue.size());
        System.out.println("queue.peek():" + queue.peek());
        System.out.println("queue.isEmpty():" + queue.isEmpty());

        queue.poll();
        System.out.println("queue.peek():" + queue.peek());

        
    }
}
